Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@rosen-chains/abstract-chain
Advanced tools
this project contains abstract classes to implement any chain for Rosen-bridge
Every blockchain supported by the guard-service in the bridge has some requirements that are defined in abstract classes and structures in this project.
AbstractChain
is an abstract class containing all actions required by guard-service to
support a blockchain in rosen-bridge. Each chain requires some actions to communicate with
the blockchain APIs to get/send data from/to the blockchain. These actions are defined in
AbstractChainNetwork
and a single object of it will be initiated in AbstractChain
constructor.
Since UTxO-based blockchains require some additional and common actions such as getting boxes
(UTxOs), AbstractUtxoChain
and AbstractUtxoChainNetwork
class are provided too.
Adding a new chain to the guard-service is being done in two steps and is independent of implementing a required network package.
The first step is to define an abstract network class inheriting AbstractChain
(or
AbstractUtxoChain
if the blockchain is UTxO-based). Based on the implementation of chain
class, some network functions may be added to this network class.
// Ergo is an UTxO-based blockchain, so class inherits `AbstractUtxoChainNetwork`
// Abstract<chain_name>Network
class AbstractErgoNetwork extends AbstractUtxoChainNetwork {
...
}
After defining network class, a chain class should be implemented, inheriting AbstractChain
(or AbstractUtxoChain
if the blockchain is UTxO-based) which implements all required functions.
The functions will be explained in the Chain Class Document section. Any required
actions found in this step which relates directly to the blockchain network should be added to the
network class. Also network
variable type should be declared as the network class type.
// Ergo is an UTxO-based blockchain, so class inherits `AbstractUtxoChain`
// <chain_name>Chain
class ErgoChain extends AbstractUtxoChain {
declare network: ErgoNetwork;
...
}
Note that implementing chain class is independent of implementing its network class and only its definition is required.
Implementing a network class for a chain can proceed after an abstract network class is defined for that chain. In order to implement a new network, a class inheriting the chain's network class should be implemented. The functions will be explained in the Network Class Document section. Class name should contain both name of the chain and source of data. For example, in case of Ergo chain and adding a network class to communicate with Explorer, the class will be as follows:
// <chain_name><data_source>Network
class ErgoExplorerNetwork extends ErgoNetwork {
...
}
Note that network class should be developed in a separate package, independent of the chain package.
AbstractChain
Required functions are as follows:
generatePaymentTransaction
eventId
the event idtxType
transaction typeorder
the payment order (list of single payments)unsignedTransactions
ongoing unsigned PaymentTransactions which will be used to prevent double spending (gathered from database and guard TxAgreement process)serializedSignedTransactions
the serialized string of ongoing signed transactions which will be used for chaining transactions (gathered from database and mempool)getTransactionAssets
transaction
the PaymentTransactionextractTransactionOrder
transaction
the PaymentTransactionverifyTransactionFee
transaction
the PaymentTransactionverifyNoTokenBurned
transaction
the PaymentTransactionverifyTransactionExtraConditions
transaction
the PaymentTransactionverifyEvent
event
the event trigger modeleventSerializedBox
the serialized string of the event trigger boxfeeConfig
minimum fee and rsn ratio config for the eventisTxValid
transaction
the transactionsignTransaction
transaction
the transactionrequiredSign
the required number of signgetTxConfirmationStatus
transactionId
the transaction idtransactionType
type of the transactionsubmitTransaction
transaction
the transactionisTxInMempool
transactionId
the transaction idgetMinimumNativeToken
getRWTToken
PaymentTransactionFromJson
jsonString
the json representation of the payment transactionAbstractUtxoChain
Required functions which only are needed in UTxO-based chains are as follows:
getMempoolBoxMapping
address
the addresstokenId
the token idgetBoxInfo
serializedBox
the serialized string of the boxAbstractChainNetwork
Required functions are as follows:
getHeight
getTxConfirmation
transactionId
the transaction idgetAddressAssets
address
the addressgetBlockTransactionIds
blockId
the block idgetBlockInfo
blockId
the block idgetTransaction
transactionId
the transaction idblockId
the block idsubmitTransaction
transaction
the transactiongetMempoolTransactions
AbstractUtxoChainNetwork
Required functions that are only needed in UTxO-based chains are as follows:
getAddressBoxes
address
the addressoffset
limit
isBoxUnspentAndValid
boxId
the box idFAQs
this project contains abstract classes to implement any chain for Rosen-bridge
We found that @rosen-chains/abstract-chain demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.